package com.cheetah.cloud2020.config;

import com.cheetah.cloud2020.bean.ResponseResult;
import com.cheetah.cloud2020.bean.ResultCode;
import org.springframework.security.core.AuthenticationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class RestExceptionHandler {

    @ExceptionHandler(AuthenticationException.class)
    public ResponseResult handlerAuthException(AuthenticationException e) {
        return ResponseResult.fail(ResultCode.VALIDATE_FAILED.getCode(), e.getMessage());
    }
}
